<?php $this->load->view('common/header'); ?>
<?php $this->load->view('home/header-common'); ?>
	<section id="home-roles">
		<div class="container">
			<div class="row-fluid">
				<div class="span3">
					<?php $this->load->view("home/left");?>
				</div>
				<div class="span9">
					<form action="<?php echo site_url("home/roles");?>" class="form-horizontal well" method="post">
						<fieldset>
							<legend>论坛账户</legend>
							<?php if (empty($roles)) {?>
								<p>您还没有论坛角色，快去创建一个吧!</p><a href="<?php echo site_url("home/createrole");?>" class="btn">创建新的论坛账户</a>
							<?php } else {?>
							<?php if (isset($_SESSION["adminid"]) && intval($_SESSION["adminid"]) != 0 ) {?>
								<a href="<?php echo site_url("home/createrole");?>" class="btn">创建新的论坛账户</a>
							<?php }?>
							<div class="control-group">
								<table class="table">
									<thead>
										<tr>
											<th>默认角色</th>
											<th>论坛名</th>
											<th>创建时间</th>
											<th></th>
										</tr>
									</thead>
									<tbody>
										<?php foreach ($roles as $key => $value) {?>
										<tr>
											<td><input type="radio" value="<?php echo $value["id"]?>" id="roles<?php echo $value["id"];?>" name="roles[]"<?php if ($value["isdefault"] == "1") echo "checked";?>></td>
											<td><label for="roles<?php echo $value["id"];?>"><?php echo $value["uc_name"];?></label></td>
											<td><?php echo date("Y年m月d日 H:i:s", $value["regdate"]);?></td>
											<td><a href="<?php echo site_url("/home/changeRole")."/".$value["uc_id"];?>">用该账户临时登录</a></td>
										</tr>
										<?php } ?>
										
									</tbody>
								</table>
							</div>
							<?php if (isset($success)) { ?>
							<div class="alert alert-success">
								<a class="close" data-dismiss="alert">×</a>
								<strong><?php echo $success; ?></strong>
							</div>
							<?php } ?> 
							<div class="form-actions">
								<button type="submit" class="btn btn-primary">保存</button>
							</div>
							<?php } ?>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
	</section>